/*--------------------------------------------------------------------------------------*\
**
** adv_blacksmith.h
**
** Heroes IV
** Copyright 2000, The 3DO Company
**
\*--------------------------------------------------------------------------------------*/

#ifndef ADV_BLACKSMITH_H_INCLUDED
#define ADV_BLACKSMITH_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <map>

#include "bitmap_group_ptr.h"
#include "bitmap_layer_ptr.h"
#include "bool_array.h"
#include "blacksmith_window.h"
#include "hero.h"
#include "single_use_object.h"

class t_player;

// Adventure object blacksmith class.
class t_adv_blacksmith : public t_single_use_object
{
public:
                
    t_adv_blacksmith(  std::string const& source );
    virtual void	activate_trigger( t_army* army, t_adv_map_point const& point, 
		                              t_direction direction, t_adventure_frame* frame );
	virtual float	ai_value( t_adventure_ai const& ai, t_creature_array const& army, int move_cost ) const;	
	virtual int     get_version() const;
	virtual void	place( t_adventure_map & map, t_adv_map_point const & point );
	virtual bool    read( std::streambuf&						stream, 
					      t_qualified_adv_object_type const&	type,
					      int									version );
	virtual void	right_click( t_mouse_event const& event,
								     t_adventure_frame* adventure_frame );
    virtual bool    write( std::streambuf& stream ) const;

protected:
	typedef std::map< float, int > t_purchase_options;
    
    t_artifact_type m_available_potions[k_max_potions];
    t_artifact_type m_available_items[k_max_items-1];
    t_artifact_type m_available_long_items[1];
	t_bool_array	m_visited;
    
	void			calculate_purchase_options( t_purchase_options& purchase_options, t_creature_array const& army ) const;
    void			create_items_list();
	virtual void	visit( t_hero* hero ); 
    
};

#endif // ADV_BLACKSMITH_H_INCLUDED

